<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="referrer" content="never">
    <title>重点突出</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style: none;
        }

        body {
            background-color: #000;
        }

        .box {
            width: 630px;
            padding: 5px;
            margin: 50px auto;
            border: 1px solid #fff;
            overflow: hidden;
        }

        .box img {
            float: left;
            margin: 5px;
        }
    </style>
</head>

<body>
    <div class="box">
        <img src="../lib/image/jquery/focus/01.jpg" alt="q">
        <img src="../lib/image/jquery/focus/02.jpg" alt="">
        <img src="../lib/image/jquery/focus/03.jpg" alt="">
        <img src="../lib/image/jquery/focus/04.jpg" alt="">
        <img src="../lib/image/jquery/focus/05.jpg" alt="">
        <img src="../lib/image/jquery/focus/06.jpg" alt="">
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script type="text/javascript">
        // 给元素加遮罩层的方式  直接改变透明度
        $(".box").on("mouseenter", "img", function (){
            // 被hover元素亮，其它元素不亮
            $(this).css("opacity", 1).siblings().css("opacity", .4);
        })

        $(".box").on("mouseleave", function (){
            $("img").css("opacity", 1);
        })
    </script>
</body>

</html>